package af.fx.base.lesson4;

import javafx.application.Application;
import javafx.stage.Modality;
import javafx.stage.Stage;

/**
 * @Description
 * @Author AF
 * @Version 1.0.0
 * @Date 2024/1/24
 */
public class Main2 extends Application {

    public static void main(String[] args) {
        launch(args);
    }

    @Override
    public void start(Stage primaryStage) {
        Stage s1 = new Stage();
        s1.setTitle("S1");
        s1.show();

        Stage s2 = new Stage();
        s2.setTitle("S2");
        // 设置拥有者为s1,s1就相当于是主窗口，s2模态设为WINDOW_MODAL，这样操作s1必须先关闭s2
        s2.initModality(Modality.WINDOW_MODAL);
        s2.initOwner(s1);
        s2.show();

        Stage s3 = new Stage();
        // 设置窗口必须关闭，才可操作其他窗口
        s3.initModality(Modality.APPLICATION_MODAL);
        s3.setTitle("S3");
        s3.show();
    }
}
